import fetch from 'common/src/utils/fetch';
import baseUrl from './env';
import UTILS from "common/src/utils/utils";
import {
  param
} from 'common/src/utils';
import axios from 'axios';
const BASER_SERV_URL = '/api/baseresservice';


//  获取教师信息
function teacherDetail(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolProject/teacherDetail`,
    method: 'Post',
    data
  });
}

//  查询本院教师
function queryTeachers(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolProject/queryTeachers`,
    method: 'Post',
    data
  });
}

//  获取对应合作院校列表
function getCollegeListByNationCode(data) {
  return fetch({
    url: `${baseUrl}/overseasCollege/getCollegeListByNationCode`,
    method: 'Post',
    data
  });
}

//  根据项目类型查找留学内容
function selectContent(data) {
  return fetch({
    url: `${baseUrl}/studyAbroad/selectContent`,
    method: 'Post',
    data
  });
}

//  根据项目类型查找留学内容
function exist(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolProject/exist`,
    method: 'Post',
    data
  });
}

//  保存院级项目
function add(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolProject/add`,
    method: 'Post',
    data
  });
}

//  提交院级项目
function submit(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolProject/submit`,
    method: 'Post',
    data
  });
}

//  新增校际交流项目
function addProject(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolLevelProject/addProject`,
    method: 'Post',
    data
  });
}

//  查询研究生培养层次
function queryTrainings(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolProject/queryTrainings`,
    method: 'Post',
    data
  });
}
//  查询院级项目详情
function get(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolProject/get`,
    method: 'Post',
    data
  });
}

//  查询院级项目列表
function list(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolProject/list`,
    method: 'Post',
    data
  });
}

//  删除院级项目
function remove(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolProject/remove`,
    method: 'Post',
    data
  });
}

//  撤销院级项目
function cancel(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolProject/cancel`,
    method: 'Post',
    data
  });
}

//  修改院级项目
function modify(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolProject/modify`,
    method: 'Post',
    data
  });
}

//  审核院级项目
function approval(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolProject/approval`,
    method: 'Post',
    data
  });
}

//  启停院级项目
function enable(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolProject/enable`,
    method: 'Post',
    data
  });
}

//  导出院级项目
function exportProject(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolProject/export`,
    method: 'Post',
    data
  });
}

// 导出2
function exportExcelS(data) {
  return fetch({
    url: `${baseUrl}/export/result/` + data,
    method: 'get',
    data
  })
}

// 导出3
function exportExcelT(data) {
  return fetch({
    url: `${baseUrl}/export/file/?path=` + data,
    method: 'get',
    data,
    responseType: 'blob'
  }).then(res => {
    UTILS.downloadFile(res, '院校级交流项目.xls', 'application/vnd.ms-excel;charset=utf-8');

  });
}

//  学生学号/教师工号下拉框接口
function studentOrTeacherPageList(data) {
  return fetch({
    url: `${baseUrl}/sysDictionary/studentOrTeacherPageList`,
    method: 'Post',
    data
  });
}

export default {
  'teacherDetail': teacherDetail,
  'queryTeachers': queryTeachers,
  'getCollegeListByNationCode': getCollegeListByNationCode,
  'selectContent': selectContent,
  'exist': exist,
  'add': add,
  'submit': submit,
  'addProject': addProject,
  'queryTrainings': queryTrainings,
  'get': get,
  'list': list,
  'remove': remove,
  'cancel': cancel,
  'modify': modify,
  'approval': approval,
  'enable': enable,
  'exportProject': exportProject,
  'exportExcelS': exportExcelS,
  'exportExcelT': exportExcelT,
  'studentOrTeacherPageList': studentOrTeacherPageList

};
